package com.sdk.app.util;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;

public class AppCheckUtil {
	/**
	 * 判断某个包名是否存在
	 * 
	 * @param context
	 * @param packageName
	 * @return
	 */
	public static boolean isPackageInstalled(Context context, String packageName) {
		boolean r = false;
		final PackageManager pm = context.getPackageManager();
		try {
			final PackageInfo packageInfo = pm.getPackageInfo(packageName, 0);
			if (packageInfo != null) {
				r = true;
			}
		} catch (final NameNotFoundException e) {
		}
		return r;
	}
}
